Skip to content

fix(portfolio-import): 零宽字符清理与符号长度规则对齐 - #360

Closed
wannT-1 wants to merge 3 commits into
helsome:mainfrom
wannT-1:cursor/portfolio-import-symbol-length-22ff
Closed

wannT-1 wants to merge 3 commits into
helsome:mainfrom
wannT-1:cursor/portfolio-import-symbol-length-22ff

Conversation

@wannT-1

@wannT-1 wannT-1 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

改动说明

What: 去掉表头和数字里的零宽字符;导入符号长度与全仓 1–6 位规则对齐,并修正过时的 1–5 位文档说明。

Why: 零宽字符会导致表头匹配失败;符号长度规则与全仓校验不一致。

关联 Issue

Related to portfolio import robustness (Sep slice). Does not close an issue.

测试

  • Bun 1.4.3;portfolio-import 相关:110 pass;shared typecheck exit 0。

网页粘贴带上的零宽空格会让 Symbol 列表头匹配失败,整表变成没有代码的行。现在表头和数值会先去掉这些不可见字符。
7 位以上的代码(如 6005191.SH、TOOLONG.US)不再被当成可直接导入的标准符号。A 股 6 位代码仍然有效,校验注释里过时的 1–5 位说明也已改掉。
CLAUDE 和 API 参考里的 5 位上限会拒绝合法的 6 位 A 股代码(如 600519.SH)。文档改为与校验实现一致的 1–6 位。
@wannT-1

wannT-1 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of #356.

13 of this branch's 15 added source lines are contained in #356. The zero-width-character normalisation it introduced is preserved there (stripInvisible), and the 1–6 symbol-length rule it also touched has since been adopted upstream independently (SYMBOL_REGEX = /^[A-Z0-9]{1,6}\.(US|HK|SG|SH|SZ|HAS)$/ in packages/longbridge-tools/src/validator.ts), so that part no longer needs a PR at all.

#356 is updated against main and its portfolio-import suite is 125 pass / 0 fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant